home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 October: Windmill on DISC / ADC Developer CD (1993-10) (''Windmill On DISC'')_iso / Dev.CD Oct 93.iso / System Software / U.S. System Software / System 7 Pro™ Beta 11 / Development Tools / Interfaces / CIncludes / OCETemplates.h < prev   
Encoding:
C/C++ Source or Header  |  1993-08-17  |  55.2 KB  |  1,498 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3. Created: Tuesday, August 17, 1993 4:37:24 PM
  4.  OCETemplates.h
  5.  C Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1990-1993
  8.   All rights reserved
  9.  
  10. ************************************************************/
  11.  
  12.  
  13. #ifndef __OCETEMPLATES__
  14. #define __OCETEMPLATES__
  15.  
  16. #ifndef REZ
  17.  
  18. #ifndef __TYPES__
  19. #include <Types.h>
  20. #endif
  21. #ifndef __EVENTS__
  22. #include <Events.h>
  23. #endif
  24.  
  25. #endif
  26.  
  27. #ifndef __OCE__
  28. #include "OCE.h"
  29. #endif
  30.  
  31. #ifndef REZ
  32. #ifndef __OCESTANDARDMAIL__
  33. #include "OCEStandardMail.h"
  34. #endif
  35. #endif
  36.  
  37.  
  38. /************************************************************************************************/
  39. /********************************* Template Resource Constants: *********************************/
  40. /************************************************************************************************/
  41.  
  42.  
  43. /* Current versions of all the different template types: */
  44.  
  45. #define kDETAspectVersion        -976
  46. #define kDETInfoPageVersion        -976
  47. #define kDETKillerVersion        -976
  48. #define kDETForwarderVersion    -976
  49. #define kDETFileTypeVersion        -976
  50.  
  51.  
  52. /*    "Normal" separation for template IDs within the file (this is just a suggestion; you can use whatever
  53.     separation you like, so long as two separate templates don't have overlapping resources): */
  54. #define kDETIDSep 250
  55.  
  56. /* A few predefined base IDs (again, just suggestions): */
  57. #define kDETFirstID        (1000)
  58. #define kDETSecondID    (1000+kDETIDSep)
  59. #define kDETThirdID        (1000+2*kDETIDSep)
  60. #define kDETFourthID    (1000+3*kDETIDSep)
  61. #define kDETFifthID        (1000+4*kDETIDSep)
  62.  
  63. /*    Templates consist of a set of associated resources, at constant offsets from a "base ID" set by the
  64.     signature resource of the template. In the case of aspect templates, most of the resources in the
  65.     template are accessible from the template as property default values. The property number is the same
  66.     as the offset from the base ID of the resource. In describing the resources which make up templates,
  67.     we give the type, the offset, and a description. For aspect templates, the offset is also the property #. */
  68.     
  69. /*    All templates include the following resource fork resources:
  70.  
  71.      Type    Offset                        Description
  72.      ----    ------                        -----------
  73.     'rstr'    kDETTemplateName            Contains the name of the template
  74.  
  75. */
  76.  
  77. #define kDETTemplateName 0
  78.  
  79. /*    Aspects, info-pages, and forwarders include the following as well:
  80.  
  81.      Type    Offset                        Description
  82.      ----    ------                        -----------
  83.     'rstr'    kDETRecordType                Contains the type of record this applies to
  84.     'rstr'    kDETAttributeType            Contains the type of attribute this applies to
  85.     'detn'    kDETAttributeValueTag        Contains the tag of the attribute values this applies to
  86.  
  87. */
  88.  
  89. #define kDETRecordType                1
  90. #define kDETAttributeType            2
  91. #define kDETAttributeValueTag        3
  92.  
  93.  
  94. /* ************************************ Aspects */
  95.  
  96. /*    In the case of aspects, property numbers and resource id offsets are the same. Therefore, some of the following
  97.     defines are used for resource offsets, some are used for dynamically generated properties, and some are used for
  98.     both (i.e., properties which may be dynamically generated, but if they aren't, then they're taken from the
  99.     resource). Resource types are given in all cases below; even if there is no actual resource (for example in
  100.     the case of kDETAspectName), it indicates the type for the dynamically generated property. A resource type of
  101.     'rstr' corresponds to a property type of kDETPrTypeString; type 'detn' corresponds to kDETPrTypeNumber; and
  102.     'detb' corresponds to kDETPrTypeBinary.
  103.  
  104.      Type    Offset                        Description
  105.      ----    ------                        -----------
  106.     'deta'    0                            Identifies the type of resource
  107.     'detc'    kDETCode                    Is the code resource, if any is used
  108.     'ICN#'    kDETAspectMainBitmap
  109.     'icl8'    kDETAspectMainBitmap
  110.     'icl4'    kDETAspectMainBitmap
  111.     'ics#'    kDETAspectMainBitmap
  112.     'ics8'    kDETAspectMainBitmap
  113.     'ics4'    kDETAspectMainBitmap
  114.     'sicn'    kDETAspectMainBitmap        Is the icon suite to display for this item type (main aspect only)
  115.     'rstr'    kDETAspectName                Contains the name of the item (attribute main aspect only)
  116.     'rst#'    kDETAspectCategory            Contains the internal categories for the record type (main aspect only)
  117.     'rst#'    kDETAspectExternalCategory    Contains the external (user-visible) names which correspond to the categories in
  118.                                         kDETAspectCategory; if this resource is not present, external names are taken from
  119.                                         another template; if no other template provides an external name for a given internal
  120.                                         category, the internal name is used as the external name (main aspect only)
  121.     'rstr'    kDETAspectKind                Is the item kind to display (main aspect only)
  122.     'detn'    kDETAspectGender            Is the gender of this kind of object for internationalization (main aspect only)
  123.     'rstr'    kDETAspectWhatIs            Is the string for balloon help when item is in sublist (main aspect only)
  124.     'rstr'    kDETAspectAliasKind            Is the item kind to display for aliases to this type of item (main aspect only)
  125.     'detn'    kDETAspectAliasGender        Is the gender of an alias to this kind of object for internationalization (main aspect only)
  126.     'rstr'    kDETAspectAliasWhatIs        Is the string for balloon help when an alias to the item is in sublist (main aspect only)
  127.     'rst#'    kDETAspectBalloons            Is a list of strings for balloon help; for each item in an info-page, it's
  128.                                         property # times 2 is used as an index into this array; if the item is not editable,
  129.                                         then the property # times 2 plus 1 is used
  130.     'rstr'    kDETAspectNewMenuName        Is the string to be used for the user to select new item creation; for records, the
  131.                                         string is used as a menu entry in the Catalogs menu; for attributes, the string
  132.                                         is used in a selection dialog invoked by an "Add..." button
  133.     'rstr'    kDETAspectNewEntryName        Is the name to be used for new records (with a digit appended if not unique)
  134.     'detb'    kDETAspectNewValue            Is the value to use when creating a new attribute value; the first four bytes
  135.                                         is the tag; the rest is the attribute value contents
  136.     'detn'    kDETAspectSublistOpenOnNew    If true (non-zero), automatically open newly created entries (property can be set
  137.                                         from a code resource, or via a default value in a resource)
  138.     'dett'    kDETAspectLookup            Is the attribute-to-property translation table
  139.     'rstr'    kDETAspectDragInString        Is a string describing the action of dragging into this aspect (if any)
  140.     'rstr'    kDETAspectDragInVerb        Is a single, short word that's the verb of the action (like "add" or "drop"; if
  141.                                         there's any doubt, use "OK")
  142.     'rstr'    kDETAspectDragInSummary        Is a short phrase that describes the action, suitable to be included in a selection list
  143.     'rst#'    kDETAspectRecordDragIn        Is a list of type pairs; in each pair, the first is the type of a record which
  144.                                         can be dragged into this aspect, and the second is the attribute type to store
  145.                                         the reference in
  146.     'rst#'    kDETAspectRecordCatDragIn    Is a list of category/attribute type pairs; in each pair, the first is the
  147.                                         category of records which can be dragged in, and the second is the type of
  148.                                         attribute to place the alias in
  149.     'rst#'    kDETAspectAttrDragIn        Is a list of type triples; in each triple, the first is the record type which can be
  150.                                         dragged from (or "" for any), the second is the attribute type which can be dragged
  151.                                         in, and the third is the attribute type to store the new attribute in
  152.     'rst#'    kDETAspectDragOut            Is a list of attribute types which can be dragged out of this aspect (an 'rst#'
  153.                                         resource with no entries means nothing can be dragged out; no 'rst#' resource means
  154.                                         everything can be dragged out)
  155.     'detm'    kDETAspectViewMenu            Is a table to fill in the view menu from
  156.     'detp'    kDETAspectReverseSort        Is a table listing which properties to sort in reverse order
  157.     'detw'    kDETAspectInfoPageCustomWindow    Is a specification of a custom window size/placement & whether to use the
  158.                                             page-selector (main aspect only)
  159.     'detv'    kDETAspectInfoPageCustomWindow    Is a view list which is common to all info-pages (main aspect only)
  160. */
  161.  
  162. #define kDETAspectCode                     4
  163. #define kDETAspectMainBitmap             5
  164. #define kDETAspectName                     6
  165. #define kDETAspectCategory                 7
  166. #define kDETAspectExternalCategory         8
  167. #define kDETAspectKind                     9
  168. #define kDETAspectGender                10
  169. #define kDETAspectWhatIs                11
  170. #define kDETAspectAliasKind                12
  171. #define kDETAspectAliasGender            13
  172. #define kDETAspectAliasWhatIs            14
  173. #define kDETAspectBalloons                15
  174. #define kDETAspectNewMenuName            16
  175. #define kDETAspectNewEntryName            17
  176. #define kDETAspectNewValue                18
  177. #define kDETAspectSublistOpenOnNew        19
  178. #define kDETAspectLookup                20
  179. #define kDETAspectDragInString            21
  180. #define kDETAspectDragInVerb            22
  181. #define kDETAspectDragInSummary            23
  182. #define kDETAspectRecordDragIn            24
  183. #define kDETAspectRecordCatDragIn        25
  184. #define kDETAspectAttrDragIn            26
  185. #define kDETAspectAttrDragOut            27
  186. #define kDETAspectViewMenu                28
  187. #define kDETAspectReverseSort            29
  188. #define kDETAspectInfoPageCustomWindow    30
  189.  
  190.  
  191. /* Properties: */
  192.  
  193. #define kDETNoProperty                -1
  194.  
  195. /* Each aspect has 250 attribute properties in this range: */
  196. #define kDETFirstLocalProperty        0
  197. #define kDETLastLocalProperty         (kDETFirstLocalProperty+249)
  198.  
  199. /* Developers should use property numbers starting at this point: */
  200. #define kDETFirstDevProperty        40
  201.  
  202. /* The following range provides constant numeric properties for use in patterns and comparisons (constant n is
  203.    given by kDETFirstConstantProperty+n): */
  204. #define kDETFirstConstantProperty    250
  205. #define kDETLastConstantProperty    (kDETFirstConstantProperty+249)
  206.  
  207. /* To convert a number into a constant property, add this: */
  208. #define kDETConstantProperty        kDETFirstConstantProperty
  209.  
  210. #define kDETZeroProperty            (kDETConstantProperty+0)
  211. #define kDETOneProperty                (kDETConstantProperty+1)
  212. #define kDETFalseProperty            (kDETConstantProperty+0)
  213. #define kDETTrueProperty            (kDETConstantProperty+1)
  214.  
  215. /* The following apply to records, attributes, or aliases; they are the name and kind, as they appear in icon lists: */
  216. #define kDETPrName                     3050
  217. #define kDETPrKind                     3051
  218.  
  219. /* Access mask properties: */
  220. #define kDETDNodeAccessMask            25825    /* The DNode access mask */
  221. #define kDETRecordAccessMask        25826    /* The record access mask */
  222. #define kDETAttributeAccessMask        25827    /* The attribute access mask */
  223. #define kDETPrimaryMaskByBit        25828    /* A set of sixteen properties to access all bits of the primary mask */
  224.  
  225. /* See AOCE documentation for details definitions of each of these bits: */
  226. #define kDETPrimarySeeMask            kDETPrimaryMaskByBit
  227. #define kDETPrimaryAddMask            (kDETPrimaryMaskByBit+1)
  228. #define kDETPrimaryDeleteMask        (kDETPrimaryMaskByBit+2)
  229. #define kDETPrimaryChangeMask        (kDETPrimaryMaskByBit+3)
  230. #define kDETPrimaryRenameMask        (kDETPrimaryMaskByBit+4)
  231. #define kDETPrimaryChangePrivsMask    (kDETPrimaryMaskByBit+5)
  232. #define kDETPrimaryTopMaskBit        (kDETPrimaryMaskByBit+15)
  233.  
  234. /* The following property is zero until we've completed the first catalog lookup; from then on it's 1 */
  235. #define kDETPastFirstLookup            26550
  236.  
  237. /* The following property is the page number; issuing a property command with this property will flip info-pages */
  238. #define kDETInfoPageNumber            27050
  239.  
  240. /* The value of the following properties contains the template number of the targeted aspect's template, and the
  241.    currently open info-page (if any). These values can be used with kDETAspectTemplate and kDETInfoPageTemplate
  242.    target selectors. */
  243. #define kDETAspectTemplateNumber    26551
  244. #define kDETInfoPageTemplateNumber    26552
  245.  
  246. /* Properties for property commands to deal with sublist items: */
  247. #define kDETOpenSelectedItems        26553    /* Open selected sublist items */
  248. #define kDETAddNewItem                26554    /* Add new sublist item */
  249. #define kDETRemoveSelectedItems        26555    /* Remove selected sublist items */
  250.  
  251. /* Property types are used to specify types of properties and conversions between types (zero and negative numbers
  252.    are reserved for Apple; developer code resources can use positive numbers): */
  253. #define kDETPrTypeNumber            -1    /* A number */
  254. #define kDETPrTypeString            -2    /* A string */
  255. #define kDETPrTypeBinary            -3    /* A binary block */
  256.  
  257. /* Rez-compatible tag definitions (•••these are the same as in OCE.h, but they're enums there and can't be rezed•••) */
  258. #ifdef REZ
  259. #define typeRString            'rstr'
  260. #define typePackedDSSpec    'dspc'
  261. #define typeBinary            'bnry'
  262. #endif
  263.  
  264. /* ************************************ Info-pages */
  265.  
  266. /* Info-pages include the following as well:
  267.  
  268.      Type    Offset                        Description
  269.      ----    ------                        -----------
  270.     'deti'    0                            Identifies the type of resource; see below for details on the contents
  271.     'rstr'    kDETInfoPageName            Is the name of the view to use in the page selection pop-up
  272.     'rstr'    kDETInfoPageMainViewAspect    Is the name of the aspect to use with the main page view
  273.     'rstr'    kDETInfoPageMenuName        Is the name of the catalogs menu ("Catalogs" if not present)
  274.     'detm'    kDETInfoPageMenuEntries        Are menu entries to go in the Catalogs menu
  275.  
  276. */
  277.  
  278. #define kDETInfoPageName            4
  279. #define kDETInfoPageMainViewAspect    5
  280. #define kDETInfoPageMenuName        6
  281. #define kDETInfoPageMenuEntries        7
  282.  
  283.  
  284. /* ************************************ Views */
  285.  
  286. /* Flags: */
  287.  
  288. #define kDETNoFlags                        0
  289. #define kDETEnabled                        (1 << 0)    /* Main view (non-sublist) field enabled */
  290.  
  291. /* The following flags make sense for items in a sublist only */
  292. #define kDETHilightIfSelected            (1 << 0)    /* Hilight view when entry is selected */
  293.  
  294. /* The following flags make sense for text views only */
  295. #define kDETNumericOnly                    (1 << 3)    /* Only allow the user to enter digits */
  296. #define kDETMultiLine                    (1 << 4)    /* Allow multiple lines in view */
  297. #define kDETDynamicSize                    (1 << 9)    /* Don't draw box around text until user clicks in it, then auto-size it */
  298. #define kDETAllowNoColons                (1 << 10)    /* Don't allow the user to enter colons (convert ":"s to "-"s) */
  299.  
  300. /* The following flags are used for pop-up menus only */
  301. #define kDETPopupDynamicSize            (1 << 8)    /* Automatically resize pop-up based on contents */
  302.  
  303. /* The following flags are used for EditPicture views only */
  304. #define kDETScaleToView                    (1 << 8)    /* Scale picture to view bounds rather than cropping */
  305.  
  306. /*    Sizes for icons */
  307. #define kDETLargeIcon        0
  308. #define kDETSmallIcon        1
  309. #define kDETMiniIcon        2
  310.  
  311. /* Stolen from TextEdit.h */
  312. #define kDETLeft          0
  313. #define kDETCenter          1
  314. #define kDETRight         -1
  315.  
  316. /* Flags for use within Box view type attributes - these are distinct from the flags above */
  317.  
  318. #define    kDETUnused                    0
  319. #define kDETBoxTakesContentClicks    (1 << 0)
  320. #define kDETBoxIsRounded            (1 << 1)
  321. #define kDETBoxIsGrayed                (1 << 2)
  322. #define kDETBoxIsInvisible            (1 << 3)
  323.  
  324. /* The common font info */
  325.  
  326. #define kDETApplicationFont                 1
  327. #define kDETApplicationFontSize          9
  328. #define kDETAppFontLineHeight            12
  329.  
  330. #define kDETSystemFont                     0
  331. #define kDETSystemFontSize                12
  332. #define kDETSystemFontLineHeight        16
  333.  
  334. #define kDETDefaultFont                     1
  335. #define kDETDefaultFontSize                 9
  336. #define kDETDefaultFontLineHeight        12
  337.  
  338. /*    These were taken from QuickDraw.h (where they're enums and therefore unusable in resource definitions): */
  339. #define kDETNormal                        0
  340. #define kDETBold                        1
  341. #define kDETItalic                        2
  342. #define kDETUnderline                    4
  343. #define kDETOutline                        8
  344. #define kDETShadow                     0x10
  345. #define kDETCondense                 0x20
  346. #define kDETExtend                     0x40
  347.  
  348. #define kDETIconStyle                   -3    /* Normal text style for regular sublist entries, italic text style for aliases */
  349.  
  350. /* View menu: */
  351.  
  352. #define    kDETChangeViewCommand        'view'    /* Change the view; used especially in StaticCommandTextFromView sublist headers */
  353.  
  354.  
  355. /* Info-page window sizes: */
  356.  
  357. /* Default record info-pages: */
  358. #define kDETRecordInfoWindHeight        228
  359. #define kDETRecordInfoWindWidth            400
  360.  
  361. /* Default attribute info-pages: */
  362. #define kDETAttributeInfoWindHeight        250
  363. #define kDETAttributeInfoWindWidth        230
  364.  
  365. /* Page identifying icon (for default info-page layout): */
  366. #define kDETSubpageIconTop        8
  367. #define kDETSubpageIconLeft        8
  368. #define kDETSubpageIconBottom    (kDETSubpageIconTop+32)
  369. #define kDETSubpageIconRight    (kDETSubpageIconLeft+32)
  370. #define kDETSubpageIconRect        {kDETSubpageIconTop, kDETSubpageIconLeft, kDETSubpageIconBottom, kDETSubpageIconRight}
  371.  
  372. /* The following rectangle can be used in a 'deti' with no sublist: */
  373. #define kDETNoSublistRect        {0, 0, 0, 0}
  374.  
  375.  
  376. /* ************************************ Killers */
  377.  
  378. /* Killers include the following as well:
  379.  
  380.      Type    Offset                        Description
  381.      ----    ------                        -----------
  382.     'detk'    0                            Identifies the type of resource; see below for details on the contents
  383.     'rst#'    kDETKillerName                Contains a list of template names to be killed
  384.  
  385. */
  386.  
  387. #define kDETKillerName 1
  388.  
  389.  
  390. /* ************************************ Forwarders */
  391.  
  392. /* Forwarders include the following as well:
  393.  
  394.      Type    Offset                        Description
  395.      ----    ------                        -----------
  396.     'detf'    0                            Identifies the type of resource; see below for details on the contents
  397.     'rst#'    kDETForwarderTemplateNames    Contains a list of names of templates to forward to
  398.  
  399. */
  400.  
  401. #define kDETForwarderTemplateNames    4
  402.  
  403.  
  404.  
  405.  
  406. /***********************************************************************************/
  407. /********************************* Categories: *************************************/
  408. /***********************************************************************************/
  409.  
  410. /* Internal category names: */
  411.  
  412. #define kDETCategoryAllItems        "aoce All Items"        /* Everything in or out of a category */
  413. #define kDETCategoryAddressItems    "aoce Address Items"    /* Anything that can be used to address something */
  414. #define kDETCategoryMisc            "aoce Miscellaneous"    /* Things that don't deserve their own category */
  415.  
  416.  
  417.  
  418.  
  419. /***********************************************************************************/
  420. /********************************* Code Resources: *********************************/
  421. /***********************************************************************************/
  422.  
  423. #ifndef REZ
  424.  
  425. /* Target specification: */
  426.  
  427. enum DETTargetSelector {
  428.     kDETSelf = 0,                    /* The "current" item */
  429.     kDETSelfOtherAspect,            /* Another aspect of the current item */
  430.     kDETParent,                        /* The parent (i.e., the aspect we're in the sublist of, if any) of the current item */
  431.     kDETSublistItem,                /* The itemNumberth item in the sublist */
  432.     kDETSelectedSublistItem,        /* The itemNumberth selected item in the sublist */
  433.     kDETDSSpec,                        /* The item specified by the packed DSSpec */
  434.     kDETAspectTemplate,                /* A specific aspect template (number itemNumber) */
  435.     kDETInfoPageTemplate,            /* A specific info-page template (number itemNumber) */
  436.     kDETHighSelector = 0xF000        /* Force type to be short */
  437. };
  438.  
  439. typedef enum DETTargetSelector DETTargetSelector;
  440.  
  441. struct DETTargetSpecification {
  442.     DETTargetSelector selector;            /* Target selection method (see above) */
  443.     RStringPtr aspectName;                /* The name of the aspect (kDETSelfOtherAspect, kDETSublistItem,
  444.                                            kDETSelectedSublistItem, kDETDSSpec); nil for main aspect or none;
  445.                                            always filled in for calls if there is an aspect, even if it's the main aspect */
  446.     long itemNumber;                    /* Sublist index (kDETSublistItem & kDETSelectedSublistItem & kDETAspectTemplate);
  447.                                            1-based indexing */
  448.     PackedDSSpecPtr dsSpec;                /* DSSpec (kDETDSSpec only) */
  449. };
  450.  
  451. typedef struct DETTargetSpecification DETTargetSpecification;
  452.  
  453. /* Code resource calls and call-backs both return an OSType:
  454.         kDETDidNotHandle (1)    = used by template to say "I didn't handle it" (for calls only)
  455.         noErr                    = function completed successfully
  456.         any error                = function failed, and here's why
  457. */
  458.  
  459. #define kDETDidNotHandle 1
  460.  
  461. /* Call-back functions:
  462.  
  463.         reqFunction                            Action
  464.         -----------                            ------
  465.         kDETcmdBeep                            Call SysBeep; useful for testing that a code resource's calls/call-backs are working at all
  466.  
  467.         kDETcmdBusy                            Put up watch cursor and switch processes; user events elicit a beep
  468.  
  469.         kDETcmdChangeCallFors                Change call-fors mask
  470.  
  471.         kDETcmdGetCommandSelectionCount        Get the command selection count (for calls which have a command selection list)
  472.         kDETcmdGetCommandItemN                Get command selection item n (for calls which have a command selection list)
  473.  
  474.         kDETcmdOpenDSSpec                    PackedDSSpec open (can also be done via AppleEvents -- this is a short-cut)
  475.  
  476.         kDETcmdAboutToTalk                    About to talk to user: bring us to front, disable watch cursor, etc.
  477.  
  478.         kDETcmdUnloadTemplates                Flush templates
  479.  
  480.         kDETcmdTemplateCounts                Return number of aspect and info-page templates in system
  481.  
  482.         kDETcmdGetDSSpec                    Get the PackedDSSpec for this object
  483.  
  484.         kDETcmdSublistCount                    Return the count of the sublist items
  485.         kDETcmdSelectedSublistCount            Return the count of the selected sublist items
  486.  
  487.         kDETcmdRequestSync                    Request a sync-up of the aspect with the catalog
  488.  
  489.         kDETcmdBreakAttribute                Break an attribute -- apply all applicable patterns to an attribute to generate properties
  490.  
  491.         kDETcmdGetTemplateFSSpec            Get the FSSpec of the file containing the template
  492.  
  493.         kDETcmdGetOpenEdit                    Return the property of the view being edited (or kDETNoProperty if none)
  494.         kDETcmdCloseEdit                    Close the current edit
  495.  
  496.         kDETcmdGetPropertyType                Get a property type
  497.  
  498.         kDETcmdGetPropertyNumber            Get a property, number format
  499.         kDETcmdGetPropertyRString            Get a property, RString format
  500.         kDETcmdGetPropertyBinarySize        Get a property, binary, return size
  501.         kDETcmdGetPropertyBinary            Get a property, binary format
  502.  
  503.         kDETcmdGetPropertyChanged            Get a property changed flag
  504.         kDETcmdGetPropertyEditable            Get a property editable flag
  505.  
  506.         kDETcmdSetPropertyType                Set a property type
  507.  
  508.         kDETcmdSetPropertyNumber            Set a property, number format
  509.         kDETcmdSetPropertyRString            Set a property, RString format
  510.         kDETcmdSetPropertyBinary            Set a property, binary data & size
  511.  
  512.         kDETcmdSetPropertyChanged            Set a property changed flag
  513.         kDETcmdSetPropertyEditable            Set a property editable flag
  514.  
  515.         kDETcmdDirtyProperty                Dirty a property (notify other code resources of change)
  516.  
  517.         kDETcmdDoPropertyCommand            Issue a property command
  518.  
  519.         kDETcmdAddMenu                        Add to the end of a dynamic menu
  520.         kDETcmdRemoveMenu                    Remove a dynamic menu item
  521.         kDETcmdMenuItemRString                Get a dynamic menu item RString
  522.  
  523.         kDETcmdSaveProperty                    Force a save of a property -- apply all applicable patterns to write out the property
  524.  
  525.         kDETcmdGetCustomViewUserReference    Get custom view user reference (as given in .r file)
  526.         kDETcmdGetCustomViewBounds            Get custom view current bounds
  527.  
  528.         kDETcmdGetResource                    Get a resource from a template
  529. */
  530.  
  531.  
  532. enum DETCallBackFunctions {
  533.  
  534.     kDETcmdSimpleCallback = 0,
  535.     kDETcmdBeep,
  536.     kDETcmdBusy,
  537.     kDETcmdChangeCallFors,
  538.     kDETcmdGetCommandSelectionCount,
  539.     kDETcmdGetCommandItemN,
  540.     kDETcmdOpenDSSpec,
  541.     kDETcmdAboutToTalk,
  542.     kDETcmdUnloadTemplates,
  543.     kDETcmdTemplateCounts,
  544.  
  545.     kDETcmdTargetedCallback = 1000,
  546.     kDETcmdGetDSSpec,
  547.     kDETcmdSublistCount,
  548.     kDETcmdSelectedSublistCount,
  549.     kDETcmdRequestSync,
  550.     kDETcmdBreakAttribute,
  551.     kDETcmdGetTemplateFSSpec,
  552.     kDETcmdGetOpenEdit,
  553.     kDETcmdCloseEdit,
  554.  
  555.     kDETcmdPropertyCallback = 2000,
  556.     kDETcmdGetPropertyType,
  557.     kDETcmdGetPropertyNumber,
  558.     kDETcmdGetPropertyRString,
  559.     kDETcmdGetPropertyBinarySize,
  560.     kDETcmdGetPropertyBinary,
  561.     kDETcmdGetPropertyChanged,
  562.     kDETcmdGetPropertyEditable,
  563.     kDETcmdSetPropertyType,
  564.     kDETcmdSetPropertyNumber,
  565.     kDETcmdSetPropertyRString,
  566.     kDETcmdSetPropertyBinary,
  567.     kDETcmdSetPropertyChanged,
  568.     kDETcmdSetPropertyEditable,
  569.     kDETcmdDirtyProperty,
  570.     kDETcmdDoPropertyCommand,
  571.     kDETcmdAddMenu,
  572.     kDETcmdRemoveMenu,
  573.     kDETcmdMenuItemRString,
  574.     kDETcmdSaveProperty,
  575.     kDETcmdGetCustomViewUserReference,
  576.     kDETcmdGetCustomViewBounds,
  577.     kDETcmdGetResource,
  578.  
  579.     kDETcmdHighCallback = 0xF0000000        /* Force type to be long */
  580. };
  581.  
  582. typedef enum DETCallBackFunctions DETCallBackFunctions;
  583.  
  584.  
  585. #define DETCallBackBlockHeader \
  586.     DETCallBackFunctions reqFunction;    /* Requested function */
  587.  
  588. #define DETCallBackBlockTargetedHeader \
  589.     DETCallBackFunctions reqFunction;    /* Requested function */\
  590.     DETTargetSpecification target;        /* The target for the request */
  591.  
  592. #define DETCallBackBlockPropertyHeader \
  593.     DETCallBackFunctions reqFunction;    /* Requested function */\
  594.     DETTargetSpecification target;        /* The target for the request */\
  595.     short property;                        /* The property to apply the request to */
  596.  
  597.  
  598. struct DETProtoCallBackBlock {
  599.     DETCallBackBlockPropertyHeader
  600. };
  601.  
  602. typedef struct DETProtoCallBackBlock DETProtoCallBackBlock;
  603.  
  604.  
  605. struct DETBeepBlock {
  606.     DETCallBackBlockHeader
  607. };
  608.  
  609. typedef struct DETBeepBlock DETBeepBlock;
  610.  
  611. struct DETBusyBlock {
  612.     DETCallBackBlockHeader
  613. };
  614.  
  615. typedef struct DETBusyBlock DETBusyBlock;
  616.  
  617. struct DETChangeCallForsBlock {
  618.     DETCallBackBlockTargetedHeader
  619.     long newCallFors;                    /*  -> New call-for mask */
  620. };
  621.  
  622. typedef struct DETChangeCallForsBlock DETChangeCallForsBlock;
  623.  
  624. struct DETGetCommandSelectionCountBlock {
  625.     DETCallBackBlockHeader
  626.     long count;                            /* <-  The number of items in the command selection list */
  627. };
  628.  
  629. typedef struct DETGetCommandSelectionCountBlock DETGetCommandSelectionCountBlock;
  630.  
  631. enum DETItemType {
  632.     kDETHFSType = 0,                /* HFS item type */
  633.     kDETDSType,                        /* Catalog Service item type */
  634.     kDETMailType,                    /* Mail (letter) item type */
  635.     kDETMoverType,                    /* Sounds, fonts, etc., from inside a suitcase or system file */
  636.     kDETLastItemType = 0xF0000000    /* Force it to be a long (C & C++ seem to disagree about the definition of 0xF000) */
  637. };
  638.  
  639. typedef enum DETItemType DETItemType;
  640.  
  641. struct DETFSInfo {                /* FSSpec plus possibly interesting additional info */
  642.     OSType fileType;            /* File type */
  643.     OSType fileCreator;            /* File creator */
  644.     unsigned short fdFlags;        /* Finder flags */
  645.     FSSpec fsSpec;                /* FSSpec */
  646. };
  647.  
  648. typedef struct DETFSInfo DETFSInfo;
  649.  
  650. struct DETGetCommandItemNBlock {
  651.     DETCallBackBlockHeader
  652.     long itemNumber;                    /*  -> Item number to retrieve (1-based) */
  653.     DETItemType itemType;                /*  -> Type of item to be returned (if we can interpret it as such) */
  654.     union {
  655.         DETFSInfo** fsInfo;                /* <-  FSSpec & info for item (caller must DisposHandle() when done) */
  656.         struct {
  657.             PackedDSSpecPtr* dsSpec;    /* <-  DSSpec for item (caller must DisposHandle() when done) */
  658.             short refNum;                /* <-  Refnum for returned address */
  659.             AuthIdentity identity;        /* <-  Identity for returned address */
  660.         } ds;
  661.         PackedDSSpecPtr* dsSpec;        /* <-  DSSpec for item (caller must DisposHandle() when done) */
  662.         LetterSpec** ltrSpec;            /* <-  Letter spec for item (caller must DisposHandle() when done) */
  663.     } item;
  664. };
  665.  
  666. typedef struct DETGetCommandItemNBlock DETGetCommandItemNBlock;
  667.  
  668. struct DETGetDSSpecBlock {
  669.     DETCallBackBlockTargetedHeader
  670.     PackedDSSpecPtr* dsSpec;            /* <-  Handle with result (caller must DisposHandle() when done) */
  671.     short refNum;                        /* <-  Refnum for address if PD */
  672.     AuthIdentity identity;                /* <-  Identity for address */
  673.     Boolean isAlias;                    /* <-  True if this entry is an alias */
  674.     Boolean isRecordRef;                /* <-  True if this entry is a record reference (reserved) */
  675. };
  676.  
  677. typedef struct DETGetDSSpecBlock DETGetDSSpecBlock;
  678.  
  679. struct DETGetTemplateFSSpecBlock {
  680.     DETCallBackBlockTargetedHeader
  681.     FSSpec fsSpec;                        /* <-  FSSpec of template file */
  682.     short baseID;                        /* <-  Base ID of this template */
  683.     long aspectTemplateNumber;            /* <-  The template number for this aspect template */
  684. };
  685.  
  686. typedef struct DETGetTemplateFSSpecBlock DETGetTemplateFSSpecBlock;
  687.  
  688. struct DETGetOpenEditBlock {
  689.     DETCallBackBlockTargetedHeader
  690.     short viewProperty;                    /* <-  The property of the view being edited (or kNoProperty if none) */
  691. };
  692.  
  693. typedef struct DETGetOpenEditBlock DETGetOpenEditBlock;
  694.  
  695. struct DETCloseEditBlock {
  696.     DETCallBackBlockTargetedHeader
  697. };
  698.  
  699. typedef struct DETCloseEditBlock DETCloseEditBlock;
  700.  
  701. struct DETGetPropertyTypeBlock {
  702.     DETCallBackBlockPropertyHeader
  703.     short propertyType;                    /* <-  The type of the property */
  704. };
  705.  
  706. typedef struct DETGetPropertyTypeBlock DETGetPropertyTypeBlock;
  707.  
  708. struct DETGetPropertyNumberBlock {
  709.     DETCallBackBlockPropertyHeader
  710.     unsigned long propertyValue;        /* <-  The value of the property */
  711. };
  712.  
  713. typedef struct DETGetPropertyNumberBlock DETGetPropertyNumberBlock;
  714.  
  715. struct DETGetPropertyRStringBlock {
  716.     DETCallBackBlockPropertyHeader
  717.     RStringHandle propertyValue;        /* <-  A handle containing the property (as an RString) (caller must DisposHandle() when done) */
  718. };
  719.  
  720. typedef struct DETGetPropertyRStringBlock DETGetPropertyRStringBlock;
  721.  
  722. struct DETGetPropertyBinarySizeBlock {
  723.     DETCallBackBlockPropertyHeader
  724.     long propertyBinarySize;            /* <-  The size of the property as a binary block */
  725. };
  726.  
  727. typedef struct DETGetPropertyBinarySizeBlock DETGetPropertyBinarySizeBlock;
  728.  
  729. struct DETGetPropertyBinaryBlock {
  730.     DETCallBackBlockPropertyHeader
  731.     Handle propertyValue;                /* <-  Handle with the value of the property (caller must DisposHandle() when done) */
  732. };
  733.  
  734. typedef struct DETGetPropertyBinaryBlock DETGetPropertyBinaryBlock;
  735.  
  736. struct DETGetPropertyChangedBlock {
  737.     DETCallBackBlockPropertyHeader
  738.     Boolean propertyChanged;            /* <-  True if the property is marked as changed */
  739. };
  740.  
  741. typedef struct DETGetPropertyChangedBlock DETGetPropertyChangedBlock;
  742.  
  743. struct DETGetPropertyEditableBlock {
  744.     DETCallBackBlockPropertyHeader
  745.     Boolean propertyEditable;            /* <-  True if the property can be edited by the user (if false, view will appear disabled) */
  746. };
  747.  
  748. typedef struct DETGetPropertyEditableBlock DETGetPropertyEditableBlock;
  749.  
  750. struct DETSetPropertyTypeBlock {
  751.     DETCallBackBlockPropertyHeader
  752.     short newType;                        /*  -> New type for property (just sets type, does not convert contents) */
  753. };
  754.  
  755. typedef struct DETSetPropertyTypeBlock DETSetPropertyTypeBlock;
  756.  
  757. struct DETSetPropertyNumberBlock {
  758.     DETCallBackBlockPropertyHeader
  759.     unsigned long newValue;                /*  -> New value to set property to (and set type to number) */
  760. };
  761.  
  762. typedef struct DETSetPropertyNumberBlock DETSetPropertyNumberBlock;
  763.  
  764. struct DETSetPropertyRStringBlock {
  765.     DETCallBackBlockPropertyHeader
  766.     RStringPtr newValue;                /*  -> New value to set property to (and set type to RString) */
  767. };
  768.  
  769. typedef struct DETSetPropertyRStringBlock DETSetPropertyRStringBlock;
  770.  
  771. struct DETSetPropertyBinaryBlock {
  772.     DETCallBackBlockPropertyHeader
  773.     Ptr newValue;                        /*  -> New value to set property to (and set type to binary) */
  774.     long newValueSize;                    /*  -> Size of new value */
  775. };
  776.  
  777. typedef struct DETSetPropertyBinaryBlock DETSetPropertyBinaryBlock;
  778.  
  779. struct DETSetPropertyChangedBlock {
  780.     DETCallBackBlockPropertyHeader
  781.     Boolean propertyChanged;            /*  -> Value to set changed flag on property to */
  782. };
  783.  
  784. typedef struct DETSetPropertyChangedBlock DETSetPropertyChangedBlock;
  785.  
  786. struct DETSetPropertyEditableBlock {
  787.     DETCallBackBlockPropertyHeader
  788.     Boolean propertyEditable;            /*  -> Value to set editable flag on property to */
  789. };
  790.  
  791. typedef struct DETSetPropertyEditableBlock DETSetPropertyEditableBlock;
  792.  
  793. struct DETDirtyPropertyBlock {
  794.     DETCallBackBlockPropertyHeader
  795. };
  796.  
  797. typedef struct DETDirtyPropertyBlock DETDirtyPropertyBlock;
  798.  
  799. struct DETDoPropertyCommandBlock {
  800.     DETCallBackBlockPropertyHeader
  801.     long parameter;                        /* ->  Parameter of command */
  802. };
  803.  
  804. typedef struct DETDoPropertyCommandBlock DETDoPropertyCommandBlock;
  805.  
  806. struct DETSublistCountBlock {
  807.     DETCallBackBlockTargetedHeader
  808.     long count;                            /* <-  The number of items in the current item's sublist */
  809. };
  810.  
  811. typedef struct DETSublistCountBlock DETSublistCountBlock;
  812.  
  813. struct DETSelectedSublistCountBlock {
  814.     DETCallBackBlockTargetedHeader
  815.     long count;                            /* <-  The number of selected items in the current item's sublist */
  816. };
  817.  
  818. typedef struct DETSelectedSublistCountBlock DETSelectedSublistCountBlock;
  819.  
  820. struct DETRequestSyncBlock {
  821.     DETCallBackBlockTargetedHeader
  822. };
  823.  
  824. typedef struct DETRequestSyncBlock DETRequestSyncBlock;
  825.  
  826. struct DETAddMenuBlock {
  827.     DETCallBackBlockPropertyHeader
  828.     RString* name;                        /*  -> Name of new menu item */
  829.     long parameter;                        /*  -> Parameter to return when this item is selected */
  830.     long addAfter;                        /*  -> Parameter of entry to add after, or -1 for add at end */
  831. };
  832.  
  833. typedef struct DETAddMenuBlock DETAddMenuBlock;
  834.  
  835. struct DETRemoveMenuBlock {
  836.     DETCallBackBlockPropertyHeader
  837.     long itemToRemove;                    /*  -> Parameter of menu item to remove */
  838. };
  839.  
  840. typedef struct DETRemoveMenuBlock DETRemoveMenuBlock;
  841.  
  842. struct DETMenuItemRStringBlock {
  843.     DETCallBackBlockPropertyHeader
  844.     long itemParameter;                    /*  -> Parameter of menu item to return string for */
  845.     RStringHandle rString;                /* <-  Handle with the RString (caller must DisposHandle() when done) */
  846. };
  847.  
  848. typedef struct DETMenuItemRStringBlock DETMenuItemRStringBlock;
  849.  
  850. struct DETOpenDSSpecBlock {
  851.     DETCallBackBlockHeader
  852.     PackedDSSpecPtr dsSpec;                /*  -> DSSpec of object to be opened */
  853. };
  854.  
  855. typedef struct DETOpenDSSpecBlock DETOpenDSSpecBlock;
  856.  
  857. struct DETAboutToTalkBlock {
  858.     DETCallBackBlockHeader
  859. };
  860.  
  861. typedef struct DETAboutToTalkBlock DETAboutToTalkBlock;
  862.  
  863. struct DETBreakAttributeBlock {
  864.     DETCallBackBlockTargetedHeader
  865.     AttributePtr breakAttribute;        /*  -> Attribute to parse */
  866.     Boolean isChangeable;                /*  -> True if the value can be changed by the user */
  867. };
  868.  
  869. typedef struct DETBreakAttributeBlock DETBreakAttributeBlock;
  870.  
  871. struct DETSavePropertyBlock {
  872.     DETCallBackBlockPropertyHeader
  873. };
  874.  
  875. typedef struct DETSavePropertyBlock DETSavePropertyBlock;
  876.  
  877. struct DETGetCustomViewUserReferenceBlock {
  878.     DETCallBackBlockPropertyHeader
  879.     short userReference;                /* <-  User reference value, as specified in the .r file */
  880. };
  881.  
  882. typedef struct DETGetCustomViewUserReferenceBlock DETGetCustomViewUserReferenceBlock;
  883.  
  884. struct DETGetCustomViewBoundsBlock {
  885.     DETCallBackBlockPropertyHeader
  886.     Rect bounds;                        /* <-  Bounds of the view */
  887. };
  888.  
  889. typedef struct DETGetCustomViewBoundsBlock DETGetCustomViewBoundsBlock;
  890.  
  891. struct DETGetResourceBlock {
  892.     DETCallBackBlockPropertyHeader
  893.     ResType resourceType;                /*  -> Resource type */
  894.     Handle theResource;                    /* <-  The resource handle (caller must dispose when done) */
  895. };
  896.  
  897. typedef struct DETGetResourceBlock DETGetResourceBlock;
  898.  
  899. struct DETTemplateCounts {
  900.     DETCallBackBlockHeader
  901.     long aspectTemplateCount;            /* <-  Number of aspect templates in the system */
  902.     long infoPageTemplateCount;            /* <-  Number of info-page templates in the system */
  903. };
  904.  
  905. typedef struct DETTemplateCounts DETTemplateCounts;
  906.  
  907. struct DETUnloadTemplatesBlock {
  908.     DETCallBackBlockHeader
  909. };
  910.  
  911. typedef struct DETUnloadTemplatesBlock DETUnloadTemplatesBlock;
  912.  
  913.  
  914. union DETCallBackBlock {
  915.     DETProtoCallBackBlock                    protoCallBack;
  916.     DETBeepBlock                            beep;
  917.     DETBusyBlock                            busy;
  918.     DETChangeCallForsBlock                    changeCallFors;
  919.     DETGetCommandSelectionCountBlock        getCommandSelectionCount;
  920.     DETGetCommandItemNBlock                    getCommandItemN;
  921.     DETGetDSSpecBlock                        getDSSpec;
  922.     DETGetTemplateFSSpecBlock                getTemplateFSSpec;
  923.     DETGetOpenEditBlock                        getOpenEdit;
  924.     DETCloseEditBlock                        closeEdit;
  925.     DETGetPropertyTypeBlock                    getPropertyType;
  926.     DETGetPropertyNumberBlock                getPropertyNumber;
  927.     DETGetPropertyRStringBlock                getPropertyRString;
  928.     DETGetPropertyBinarySizeBlock            getPropertyBinarySize;
  929.     DETGetPropertyBinaryBlock                getPropertyBinary;
  930.     DETGetPropertyChangedBlock                getPropertyChanged;
  931.     DETGetPropertyEditableBlock                getPropertyEditable;
  932.     DETSetPropertyTypeBlock                    setPropertyType;
  933.     DETSetPropertyNumberBlock                setPropertyNumber;
  934.     DETSetPropertyRStringBlock                setPropertyRString;
  935.     DETSetPropertyBinaryBlock                setPropertyBinary;
  936.     DETSetPropertyChangedBlock                setPropertyChanged;
  937.     DETSetPropertyEditableBlock                setPropertyEditable;
  938.     DETDirtyPropertyBlock                    dirtyProperty;
  939.     DETDoPropertyCommandBlock                doPropertyCommand;
  940.     DETSublistCountBlock                    sublistCount;
  941.     DETSelectedSublistCountBlock            selectedSublistCount;
  942.     DETRequestSyncBlock                        requestSync;
  943.     DETAddMenuBlock                            addMenu;
  944.     DETRemoveMenuBlock                        removeMenu;
  945.     DETMenuItemRStringBlock                    menuItemRString;
  946.     DETOpenDSSpecBlock                        openDSSpec;
  947.     DETAboutToTalkBlock                        aboutToTalk;
  948.     DETBreakAttributeBlock                    breakAttribute;
  949.     DETSavePropertyBlock                    saveProperty;
  950.     DETGetCustomViewUserReferenceBlock        getCustomViewUserReference;
  951.     DETGetCustomViewBoundsBlock                getCustomViewBounds;
  952.     DETGetResourceBlock                        getResource;
  953.     DETTemplateCounts                        templateCounts;
  954.     DETUnloadTemplatesBlock                    unloadTemplates;
  955. };
  956.  
  957. typedef union DETCallBackBlock DETCallBackBlock;
  958. typedef DETCallBackBlock* DETCallBackBlockPtr;
  959.  
  960.  
  961. typedef pascal OSErr (*DETCallBack) (union DETCallBlock* callBlockPtr, DETCallBackBlockPtr callBackBlockPtr);
  962.  
  963.  
  964. /* Call functions:
  965.  
  966.         reqFunction                        Action
  967.         -----------                        ------
  968.         kDETcmdInit                        Called once when template is first loaded (good time to allocate private data); returns call-for list
  969.         kDETcmdExit                        Called once when template is freed (good time to free private data)
  970.  
  971.         kDETcmdAttributeCreation        New sublist attribute creation about to occur; this gives the template a chance to modify
  972.                                         the value that's about to be created; sent to the template that will be used for
  973.                                         the main aspect of the new entry
  974.  
  975.         kDETcmdDynamicForwarders        Return a list of dynamically created forwarders
  976.  
  977.         kDETcmdInstanceInit                Called once when instance of template is started (good time to allocate private instance data)
  978.         kDETcmdInstanceExit                Called once when instance is ended (good time to free private instance data)
  979.  
  980.         kDETcmdIdle                        Called periodically during idle times
  981.  
  982.         kDETcmdViewListChanged            Called when the info-page view-list (list of enabled views) has changed
  983.  
  984.         kDETcmdValidateSave                Validate save: about to save info-page, return noErr (or kDETDidNotHandle) if it's OK to do so
  985.  
  986.         kDETcmdDropQuery                Drop query: return the appropriate operation for this drag; ask destination
  987.         kDETcmdDropMeQuery                Drop query: return the appropriate operation for this drag; ask dropee
  988.  
  989.         kDETcmdAttributeNew                Attribute value new (return kDETDidNotHandle to let normal new processing occur)
  990.         kDETcmdAttributeChange            Attribute value change (return kDETDidNotHandle to let normal change processing occur)
  991.         kDETcmdAttributeDelete            Attribute value delete (return kDETDidNotHandle to let normal deletion occur); sent to the
  992.                                         main aspect of the attribute that's about to be deleted
  993.         kDETcmdItemNew                    Target item (record or attribute) has just been created
  994.  
  995.         kDETcmdOpenSelf                    Self open (return noErr to prevent opening; return kDETDidNotHandle to allow it)
  996.  
  997.         kDETcmdDynamicResource            Return a dynamically created resource
  998.  
  999.         kDETcmdShouldSync                Check if the code resource wants to force a sync (update data from catalog)
  1000.         kDETcmdDoSync                    Give code resource a chance to sync (read in and break all attributes)
  1001.  
  1002.         kDETcmdPropertyCommand            Command received in the property number range (usually means a button's been pushed)
  1003.  
  1004.         kDETcmdMaximumTextLength        Return maximum size for text form of property
  1005.  
  1006.         kDETcmdPropertyDirtied            Property dirtied, need to redraw
  1007.  
  1008.         kDETcmdPatternIn                Custom pattern element encountered on reading in an attribute
  1009.         kDETcmdPatternOut                Custom pattern element encountered on writing out an attribute
  1010.  
  1011.         kDETcmdConvertToNumber            Convert from template-defined property type to number
  1012.         kDETcmdConvertToRString            Convert from template-defined property type to RString
  1013.         kDETcmdConvertFromNumber        Convert from number to template-defined property type
  1014.         kDETcmdConvertFromRString        Convert from RString to template-defined property type
  1015.  
  1016.         kDETcmdCustomViewDraw            Custom view draw
  1017.         kDETcmdCustomViewMouseDown        Custom view mouse down
  1018.  
  1019.         kDETcmdKeyPress                    Key press (used primarily to filter entry into EditText views)
  1020.         kDETcmdPaste                    Paste (used primarily to filter entry into EditText views)
  1021.  
  1022.         kDETcmdCustomMenuSelected        Custom Catalogs menu selected
  1023.         kDETcmdCustomMenuEnabled        Return whether custom Catalogs menu entry should be enabled
  1024. */
  1025.  
  1026.  
  1027. enum DETCallFunctions {
  1028.  
  1029.     kDETcmdSimpleCall = 0,
  1030.     kDETcmdInit,
  1031.     kDETcmdExit,
  1032.     kDETcmdAttributeCreation,
  1033.     kDETcmdDynamicForwarders,
  1034.  
  1035.     kDETcmdTargetedCall = 1000,
  1036.     kDETcmdInstanceInit,
  1037.     kDETcmdInstanceExit,
  1038.     kDETcmdIdle,
  1039.     kDETcmdViewListChanged,
  1040.     kDETcmdValidateSave,
  1041.     kDETcmdDropQuery,
  1042.     kDETcmdDropMeQuery,
  1043.     kDETcmdAttributeNew,
  1044.     kDETcmdAttributeChange,
  1045.     kDETcmdAttributeDelete,
  1046.     kDETcmdItemNew,
  1047.     kDETcmdOpenSelf,
  1048.     kDETcmdDynamicResource,
  1049.     kDETcmdShouldSync,
  1050.     kDETcmdDoSync,
  1051.  
  1052.     kDETcmdPropertyCall = 2000,
  1053.     kDETcmdPropertyCommand,
  1054.     kDETcmdMaximumTextLength,
  1055.     kDETcmdPropertyDirtied,
  1056.     kDETcmdPatternIn,
  1057.     kDETcmdPatternOut,
  1058.     kDETcmdConvertToNumber,
  1059.     kDETcmdConvertToRString,
  1060.     kDETcmdConvertFromNumber,
  1061.     kDETcmdConvertFromRString,
  1062.     kDETcmdCustomViewDraw,
  1063.     kDETcmdCustomViewMouseDown,
  1064.     kDETcmdKeyPress,
  1065.     kDETcmdPaste,
  1066.     kDETcmdCustomMenuSelected,
  1067.     kDETcmdCustomMenuEnabled,
  1068.  
  1069.     kDETcmdHighCall = 0xF0000000    /* Force the type to be long */
  1070. };
  1071.  
  1072. typedef enum DETCallFunctions DETCallFunctions;
  1073.  
  1074.  
  1075. #define DETCallBlockHeader \
  1076.     DETCallFunctions reqFunction;    /* Requested function */\
  1077.     DETCallBack callBack;            /* Pointer to call-back routine */\
  1078.     long callBackPrivate;            /* Private data for the call-back routine */\
  1079.     long templatePrivate;            /* Private storage for use by code resource (stays for life of code resource,\
  1080.                                         common to all invocations of code resource) */
  1081.  
  1082. #define DETCallBlockTargetedHeader \
  1083.     DETCallFunctions reqFunction;    /* Requested function */\
  1084.     DETCallBack callBack;            /* Pointer to call-back routine */\
  1085.     long callBackPrivate;            /* Private data for the call-back routine */\
  1086.     long templatePrivate;            /* Private storage for use by code resource (stays for life of code resource,\
  1087.                                         common to all invocations of code resource) */\
  1088.     long instancePrivate;            /* Private storage for use by code resource (separate for each item using the\
  1089.                                         code resource) */\
  1090.     DETTargetSpecification target;    /* The target (originator) of the call, for targeted and property calls */\
  1091.     Boolean targetIsMainAspect;        /* True if the target is the main aspect (even though it has a non-nil name) */
  1092.  
  1093. #define DETCallBlockPropertyHeader \
  1094.     DETCallFunctions reqFunction;    /* Requested function */\
  1095.     DETCallBack callBack;            /* Pointer to call-back routine */\
  1096.     long callBackPrivate;            /* Private data for the call-back routine */\
  1097.     long templatePrivate;            /* Private storage for use by code resource (stays for life of code resource,\
  1098.                                         common to all invocations of code resource) */\
  1099.     long instancePrivate;            /* Private storage for use by code resource (separate for each item using the\
  1100.                                         code resource) */\
  1101.     DETTargetSpecification target;    /* The target (originator) of the call, for targeted and property calls */\
  1102.     Boolean targetIsMainAspect;        /* True if the target is the main aspect (even though it has a non-nil name) */\
  1103.     short property;                    /* The property number the call refers to */
  1104.  
  1105.  
  1106. struct DETProtoCallBlock {
  1107.     DETCallBlockPropertyHeader
  1108. };
  1109.  
  1110. typedef struct DETProtoCallBlock DETProtoCallBlock;
  1111.  
  1112. struct DETInitBlock {
  1113.     DETCallBlockHeader
  1114.     long newCallFors;                /* <-  New call-for mask */
  1115. };
  1116.  
  1117. typedef struct DETInitBlock DETInitBlock;
  1118.  
  1119. struct DETExitBlock {
  1120.     DETCallBlockHeader
  1121. };
  1122.  
  1123. typedef struct DETExitBlock DETExitBlock;
  1124.  
  1125. struct DETInstanceInitBlock {
  1126.     DETCallBlockTargetedHeader
  1127. };
  1128.  
  1129. typedef struct DETInstanceInitBlock DETInstanceInitBlock;
  1130.  
  1131. struct DETInstanceExitBlock {
  1132.     DETCallBlockTargetedHeader
  1133. };
  1134.  
  1135. typedef struct DETInstanceExitBlock DETInstanceExitBlock;
  1136.  
  1137. struct DETInstanceIdleBlock {
  1138.     DETCallBlockTargetedHeader
  1139. };
  1140.  
  1141. typedef struct DETInstanceIdleBlock DETInstanceIdleBlock;
  1142.  
  1143. struct DETPropertyCommandBlock {
  1144.     DETCallBlockPropertyHeader
  1145.     long parameter;                    /*  -> Parameter of command */
  1146. };
  1147.  
  1148. typedef struct DETPropertyCommandBlock DETPropertyCommandBlock;
  1149.  
  1150. struct DETMaximumTextLengthBlock {
  1151.     DETCallBlockPropertyHeader
  1152.     long maxSize;                    /* <-  Return the maximum number of characters the user can entry when property is edited in an EditText */
  1153. };
  1154.  
  1155. typedef struct DETMaximumTextLengthBlock DETMaximumTextLengthBlock;
  1156.  
  1157. struct DETViewListChangedBlock {
  1158.     DETCallBlockTargetedHeader
  1159. };
  1160.  
  1161. typedef struct DETViewListChangedBlock DETViewListChangedBlock;
  1162.  
  1163. struct DETPropertyDirtiedBlock {
  1164.     DETCallBlockPropertyHeader
  1165. };
  1166.  
  1167. typedef struct DETPropertyDirtiedBlock DETPropertyDirtiedBlock;
  1168.  
  1169. struct DETValidateSaveBlock {
  1170.     DETCallBlockTargetedHeader
  1171.     RStringHandle errorString;        /* <-  Handle with error string if validation fails (callee must allocate handle, DE will DisposHandle() it) */
  1172. };
  1173.  
  1174. typedef struct DETValidateSaveBlock DETValidateSaveBlock;
  1175.  
  1176. /* Valid commandIDs for DETDropQueryBlock and DETDropMeQueryBlock (in addition to property numbers): */
  1177. #define kDETDoNothing    'xxx0'
  1178. #define kDETMove        'move'
  1179. #define kDETDrag        'drag'
  1180. #define kDETAlias        'alis'
  1181.  
  1182. struct DETDropQueryBlock {
  1183.     DETCallBlockTargetedHeader
  1184.     short modifiers;                /*  -> Modifiers at drop time (option/control/command/shift keys) */
  1185.     long commandID;                    /* <-> Command ID (kDETDoNothing, kDETMove, kDETDrag (copy), kDETAlias, or a property number) */
  1186.     AttributeType destinationType;    /* <-> Type to convert attribute to */
  1187.     Boolean copyToHFS;                /* <-  If true, object should be copied to HFS before being operated on, and deleted after */
  1188. };
  1189.  
  1190. typedef struct DETDropQueryBlock DETDropQueryBlock;
  1191.  
  1192. struct DETDropMeQueryBlock {
  1193.     DETCallBlockTargetedHeader
  1194.     short modifiers;                /*  -> Modifiers at drop time (option/control/command/shift keys) */
  1195.     long commandID;                    /* <-> Command ID (kDETDoNothing, kDETMove, kDETDrag (copy), kDETAlias, or a property number) */
  1196.     AttributeType destinationType;    /* <-> Type to convert attribute to */
  1197.     Boolean copyToHFS;                /* <-  If true, object should be copied to HFS before being operated on, and deleted after */
  1198. };
  1199.  
  1200. typedef struct DETDropMeQueryBlock DETDropMeQueryBlock;
  1201.  
  1202. struct DETAttributeCreationBlock {
  1203.     DETCallBlockHeader
  1204.     PackedDSSpecPtr parent;            /*  -> The object within which the creation will occur */
  1205.     short refNum;                    /*  -> Refnum for returned address (DSSpecs in PDs only) */
  1206.     AuthIdentity identity;            /*  -> The identity we're browsing as in the parent object */
  1207.     AttributeType attrType;            /* <-> The type of the attribute being created */
  1208.     AttributeTag attrTag;            /* <-> The tag of the attribute being created */
  1209.     Handle value;                    /* <-> The value to write (pre-allocated, resize as needed) */
  1210. };
  1211.  
  1212. typedef struct DETAttributeCreationBlock DETAttributeCreationBlock;
  1213.  
  1214. struct DETAttributeNewBlock {
  1215.     DETCallBlockTargetedHeader
  1216.     PackedDSSpecPtr parent;            /*  -> The object within which the creation will occur */
  1217.     short refNum;                    /*  -> Refnum for returned address (DSSpecs in PDs only) */
  1218.     AuthIdentity identity;            /*  -> The identity we're browsing as in the parent object */
  1219.     AttributeType attrType;            /* <-> The type of the attribute being created */
  1220.     AttributeTag attrTag;            /* <-> The tag of the attribute being created */
  1221.     Handle value;                    /* <-> The value to write (pre-allocated, resize as needed) */
  1222. };
  1223.  
  1224. typedef struct DETAttributeNewBlock DETAttributeNewBlock;
  1225.  
  1226. struct DETAttributeChangeBlock {
  1227.     DETCallBlockTargetedHeader
  1228.     PackedDSSpecPtr parent;            /*  -> The object within which the creation will occur */
  1229.     short refNum;                    /*  -> Refnum for returned address (DSSpecs in PDs only) */
  1230.     AuthIdentity identity;            /*  -> The identity we're browsing as in the parent object */
  1231.     AttributeType attrType;            /* <-> The type of the attribute being changed */
  1232.     AttributeTag attrTag;            /* <-> The tag of the attribute being changed */
  1233.     AttributeCreationID attrCID;    /* <-> The CID of the attribute being changed */
  1234.     Handle value;                    /* <-> The value to write (pre-allocated, resize as needed) */
  1235. };
  1236.  
  1237. typedef struct DETAttributeChangeBlock DETAttributeChangeBlock;
  1238.  
  1239. struct DETAttributeDeleteBlock {
  1240.     DETCallBlockTargetedHeader
  1241.     PackedDSSpecPtr dsSpec;            /*  -> The object within which the deletion will occur */
  1242.     short refNum;                    /*  -> Refnum for returned address (DSSpecs in PDs only) */
  1243.     AuthIdentity identity;            /*  -> The identity we're browsing as */
  1244. };
  1245.  
  1246. typedef struct DETAttributeDeleteBlock DETAttributeDeleteBlock;
  1247.  
  1248. struct DETItemNewBlock {
  1249.     DETCallBlockTargetedHeader
  1250. };
  1251.  
  1252. typedef struct DETItemNewBlock DETItemNewBlock;
  1253.  
  1254. struct DETShouldSyncBlock {
  1255.     DETCallBlockTargetedHeader
  1256.     Boolean shouldSync;                /* <-  True if we should now sync with catalog */
  1257. };
  1258.  
  1259. typedef struct DETShouldSyncBlock DETShouldSyncBlock;
  1260.  
  1261. struct DETDoSyncBlock {
  1262.     DETCallBlockTargetedHeader
  1263. };
  1264.  
  1265. typedef struct DETDoSyncBlock DETDoSyncBlock;
  1266.  
  1267. struct DETPatternInBlock {
  1268.     DETCallBlockPropertyHeader
  1269.     long elementType;                /*  -> Element type from pattern */
  1270.     long extra;                        /*  -> Extra field from pattern */
  1271.     AttributePtr attribute;            /*  -> The complete attribute */
  1272.     long dataOffset;                /* <-> Offset to current (next) byte */
  1273.     short bitOffset;                /* <-> Bit offset (next bit is *fData >> fBitOffset++) */
  1274. };
  1275.  
  1276. typedef struct DETPatternInBlock DETPatternInBlock;
  1277.  
  1278. struct DETPatternOutBlock {
  1279.     DETCallBlockPropertyHeader
  1280.     long elementType;                /*  -> Element type from pattern */
  1281.     long extra;                        /*  -> Extra field from pattern */
  1282.     AttributePtr attribute;            /*  -> The attribute (minus the data portion) */
  1283.     Handle data;                    /*  -> Data to be written (pre-allocated, resize and add at end) */
  1284.     long dataOffset;                /* <-> Offset to next byte to write */
  1285.     short bitOffset;                /* <-> Bit offset (if zero, handle will need to be resized to one more byte before write) */
  1286. };
  1287.  
  1288. typedef struct DETPatternOutBlock DETPatternOutBlock;
  1289.  
  1290. struct DETOpenSelfBlock {
  1291.     DETCallBlockTargetedHeader
  1292.     short modifiers;                /*  -> Modifiers at open time (option/control/command/shift keys) */
  1293. };
  1294.  
  1295. typedef struct DETOpenSelfBlock DETOpenSelfBlock;
  1296.  
  1297. struct DETConvertToNumberBlock {
  1298.     DETCallBlockPropertyHeader
  1299.     long theValue;                    /* <-  The converted value to return */
  1300. };
  1301.  
  1302. typedef struct DETConvertToNumberBlock DETConvertToNumberBlock;
  1303.  
  1304. struct DETConvertToRStringBlock {
  1305.     DETCallBlockPropertyHeader
  1306.     RStringHandle theValue;            /* <-  A handle with the converted value (callee must allocate handle, DE will DisposHandle() it) */
  1307. };
  1308.  
  1309. typedef struct DETConvertToRStringBlock DETConvertToRStringBlock;
  1310.  
  1311. struct DETConvertFromNumberBlock {
  1312.     DETCallBlockPropertyHeader
  1313.     long theValue;                    /*  -> The value to convert (result should be written direct to the property) */
  1314. };
  1315.  
  1316. typedef struct DETConvertFromNumberBlock DETConvertFromNumberBlock;
  1317.  
  1318. struct DETConvertFromRStringBlock {
  1319.     DETCallBlockPropertyHeader
  1320.     RStringPtr theValue;            /*  -> The value to convert (result should be written direct to the property) */
  1321. };
  1322.  
  1323. typedef struct DETConvertFromRStringBlock DETConvertFromRStringBlock;
  1324.  
  1325. struct DETCustomViewDrawBlock {
  1326.     DETCallBlockPropertyHeader
  1327. };
  1328.  
  1329. typedef struct DETCustomViewDrawBlock DETCustomViewDrawBlock;
  1330.  
  1331. struct DETCustomViewMouseDownBlock {
  1332.     DETCallBlockPropertyHeader
  1333.     EventRecord* theEvent;            /*  -> The original event record of the mouse-down */
  1334. };
  1335.  
  1336. typedef struct DETCustomViewMouseDownBlock DETCustomViewMouseDownBlock;
  1337.  
  1338. struct DETKeyPressBlock {
  1339.     DETCallBlockPropertyHeader
  1340.     EventRecord* theEvent;            /*  -> The original event record of the key-press */
  1341. };
  1342.  
  1343. typedef struct DETKeyPressBlock DETKeyPressBlock;
  1344.  
  1345. struct DETPasteBlock {
  1346.     DETCallBlockPropertyHeader
  1347.     short modifiers;                /*  -> Modifiers at paste time (option/control/command/shift keys) */
  1348. };
  1349.  
  1350. typedef struct DETPasteBlock DETPasteBlock;
  1351.  
  1352. struct DETCustomMenuSelectedBlock {
  1353.     DETCallBlockTargetedHeader
  1354.     short menuTableParameter;        /*  -> The "property" field from the custom menu table */
  1355. };
  1356.  
  1357. typedef struct DETCustomMenuSelectedBlock DETCustomMenuSelectedBlock;
  1358.  
  1359. struct DETCustomMenuEnabledBlock {
  1360.     DETCallBlockTargetedHeader
  1361.     short menuTableParameter;        /*  -> The "property" field from the custom menu table */
  1362.     Boolean enable;                    /* <-  Whether to enable the menu item */
  1363. };
  1364.  
  1365. typedef struct DETCustomMenuEnabledBlock DETCustomMenuEnabledBlock;
  1366.  
  1367. struct DETForwarderListItem {
  1368.     struct DETForwarderListItem** next;        /* Pointer to next item, or nil */
  1369.     AttributeTag attributeValueTag;            /* Tag of new templates (0 for none) */
  1370.     PackedPathName rstrs;                    /* Record type (empty if none), attrbute type (empty if none),
  1371.                                                 list of template names to forward to */
  1372. };
  1373.  
  1374. typedef struct DETForwarderListItem** DETForwarderListHandle;
  1375.  
  1376. struct DETDynamicForwardersBlock {
  1377.     DETCallBlockHeader
  1378.     DETForwarderListHandle forwarders;    /* <-  List of forwaders */
  1379. };
  1380.  
  1381. typedef struct DETDynamicForwardersBlock DETDynamicForwardersBlock;
  1382.  
  1383. struct DETDynamicResourceBlock {
  1384.     DETCallBlockTargetedHeader
  1385.     ResType resourceType;                /*  -> The resource type being requested */
  1386.     short propertyNumber;                /*  -> The property number of the resource being requested */
  1387.     short resourceID;                    /*  -> The resource ID (base ID + property number) of the resource */
  1388.     Handle theResource;                    /* <-  The requested resource */
  1389. };
  1390.  
  1391. typedef struct DETDynamicResourceBlock DETDynamicResourceBlock;
  1392.  
  1393.  
  1394. union DETCallBlock {
  1395.     DETProtoCallBlock                protoCall;
  1396.     DETInitBlock                    init;
  1397.     DETExitBlock                    exit;
  1398.     DETInstanceInitBlock            instanceInit;
  1399.     DETInstanceExitBlock            instanceExit;
  1400.     DETInstanceIdleBlock            instanceIdle;
  1401.     DETPropertyCommandBlock            propertyCommand;
  1402.     DETMaximumTextLengthBlock        maximumTextLength;
  1403.     DETViewListChangedBlock            viewListChanged;
  1404.     DETPropertyDirtiedBlock            propertyDirtied;
  1405.     DETValidateSaveBlock            validateSave;
  1406.     DETDropQueryBlock                dropQuery;
  1407.     DETDropMeQueryBlock                dropMeQuery;
  1408.     DETAttributeCreationBlock        attributeCreationBlock;
  1409.     DETAttributeNewBlock            attributeNew;
  1410.     DETAttributeChangeBlock            attributeChange;
  1411.     DETAttributeDeleteBlock            attributeDelete;
  1412.     DETItemNewBlock                    itemNew;
  1413.     DETPatternInBlock                patternIn;
  1414.     DETPatternOutBlock                patternOut;
  1415.     DETShouldSyncBlock                shouldSync;
  1416.     DETDoSyncBlock                    doSync;
  1417.     DETOpenSelfBlock                openSelf;
  1418.     DETConvertToNumberBlock            convertToNumber;
  1419.     DETConvertToRStringBlock        convertToRString;
  1420.     DETConvertFromNumberBlock        convertFromNumber;
  1421.     DETConvertFromRStringBlock        convertFromRString;
  1422.     DETCustomViewDrawBlock            customViewDraw;
  1423.     DETCustomViewMouseDownBlock        customViewMouseDown;
  1424.     DETKeyPressBlock                keyPress;
  1425.     DETPasteBlock                    paste;
  1426.     DETCustomMenuSelectedBlock        customMenuSelected;
  1427.     DETCustomMenuEnabledBlock        customMenuEnabled;
  1428.     DETDynamicForwardersBlock        dynamicForwarders;
  1429.     DETDynamicResourceBlock            dynamicResource;
  1430. };
  1431.  
  1432. typedef union DETCallBlock DETCallBlock;
  1433. typedef DETCallBlock* DETCallBlockPtr;
  1434.  
  1435. /* Call-for list: */
  1436.  
  1437. #define kDETCallForOther               1        /* Call for things not listed below (also auto-enabled by DE if any of the below are enabled) */
  1438. #define kDETCallForIdle                   2        /* kDETcmdIdle */
  1439. #define kDETCallForCommands               4        /* kDETcmdPropertyCommand, kDETcmdSelfOpen */
  1440. #define kDETCallForViewChanges           8        /* kDETcmdViewListChanged, kDETcmdPropertyDirtied, kDETcmdMaximumTextLength */
  1441. #define kDETCallForDrops            0x10        /* kDETcmdDropQuery, kDETcmdDropMeQuery */
  1442. #define kDETCallForAttributes        0x20        /* kDETcmdAttributeCreation, kDETcmdAttributeNew, kDETcmdAttributeChange, kDETcmdAttributeDelete */
  1443. #define kDETCallForValidation        0x40        /* kDETcmdValidateSave */
  1444. #define kDETCallForKeyPresses        0x80        /* kDETcmdKeyPress and kDETcmdPaste */
  1445. #define kDETCallForResources       0x100        /* kDETcmdDynamicResource */
  1446. #define kDETCallForSyncing           0x200        /* kDETcmdShouldSync, kDETcmdDoSync */
  1447. #define kDETCallForEscalation      0x8000        /* All calls escalated from the next lower level */
  1448.  
  1449. #define kDETCallForNothing               0        /* None of the above */
  1450. #define kDETCallForEverything 0xFFFFFFFF        /* All of the above */
  1451.  
  1452.  
  1453. typedef pascal OSErr (*DETCall) (DETCallBlockPtr callBlockPtr);
  1454.  
  1455.  
  1456. /* This following macro saves you from having to dig out the call-back pointer from the call block: */
  1457.  
  1458. #define CallBackDET(callBlockPtr, callBackBlockPtr) ((*callBlockPtr->protoCall.callBack)(callBlockPtr,callBackBlockPtr))
  1459.  
  1460.  
  1461. #endif
  1462.  
  1463. /************************************************************************************/
  1464. /********************************* SAM Definitions: *********************************/
  1465. /************************************************************************************/
  1466.  
  1467. /* SAM Developers should use property numbers starting at this point: */
  1468. #define kSAMFirstDevProperty                kDETFirstDevProperty + 10
  1469.  
  1470.  
  1471. /*
  1472.     SAM templates have additional resources/properties that are required
  1473.     for interaction with the AOCE Key Chain.
  1474.     
  1475.      Type    Offset                        Description
  1476.      ----    ------                        -----------
  1477.     'rstr'    kSAMAspectUserName            The user name
  1478.     'rstr'    kSAMAspectKind                The kind of SAM
  1479.     'detn'    kSAMAspectCannotDelete        If 0, then the slot cannot be deleted
  1480.     'sami'    kSAMAspectSlotCreationInfo    The info required to create a slot record
  1481. */
  1482.  
  1483. #define kSAMAspectUserName                        kDETFirstDevProperty + 1
  1484. #define kSAMAspectKind                            kDETFirstDevProperty + 2
  1485. #define kSAMAspectCannotDelete                    kDETFirstDevProperty + 3
  1486. #define kSAMAspectSlotCreationInfo                kDETFirstDevProperty + 4
  1487.  
  1488.  
  1489. /**************************************************************************************/
  1490. /********************************* Admin Definitions: *********************************/
  1491. /**************************************************************************************/
  1492.  
  1493. #define kDETAdminVersion         -978
  1494.  
  1495.  
  1496. #endif
  1497.  
  1498.